<template>
    <div>
        <div class="conta_main" v-if="searchForms.data.queryTypes=='a1'">
            <h4>班级各项指标分析</h4>
            <el-table
                :data="props.dataList['classNumList'] && props.dataList['classNumList']['classList']" border highlight-current-row
                @sort-change="sortChange($event, props.dataList['classNumList'] && props.dataList['classNumList']['classList'])" :height="520" show-summary
                :summary-method="getSummaries"
                class="table student-down-table tabs tablePadding" ref="multipleTableRef" 
                :header-cell-style="{background: '#f1f1f1', color: '#333',borderColor: 'rgb(193 193 193)',fontSize: '14px'}">
                <el-table-column label="班级名称" prop="className" align="center" width="120" header-align="center" :key="1" fixed>
                    <template #default="scope">
                        <el-button link type="primary" @click="toClassKanban(scope.row)" class="idAddName">{{scope.row.className}}</el-button>   
                    </template>
                </el-table-column>
                <el-table-column label="科目" prop="subjectName" align="center" width="80" header-align="center" :key="2" fixed></el-table-column>
                <el-table-column label="授课教师" prop="teacherName" width="140" align="center" header-align="center" :key="3" :sort-orders="['ascending', 'descending']" sortable="column" fixed></el-table-column>
                <el-table-column label="参考人数" prop="num" align="right" width="100" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column" :key="4"></el-table-column>
                <template v-if="searchForm.grades== 'a17'">
                    <el-table-column label="原始分" prop="" align="center" header-align="center" :key="5">
                        <el-table-column label="平均分年级排名" prop="ysfRank" align="right" width="80" header-align="center">
                            <template #header="scope">
                                <div @click="defaultSort = (defaultSort=='null' ? true : !defaultSort)" class="pointer-btn">
                                    <!-- <prompt-message tipType="middle" :scope="scope" :dataList="dataList" :middle="c.abProp+'Middle'" :many="c.abProp+'Many'"> -->
                                        <!-- <span slot="columnName"> -->
                                            <span>{{scope.column.label}}</span>
                                            <span class="caret-wrapper">
                                                <!-- 升序 -->
                                                <i class="sort-caret ascending" :class="{'default-sort': (defaultSort && defaultSort !='null')}"></i>
                                                <!-- 降序 -->
                                                <i class="sort-caret descending" :class="{'default-sort': !defaultSort && defaultSort != 'null'}"></i>
                                            </span>
                                        <!-- </span>  -->
                                    <!-- </prompt-message> -->
                                </div>                               
                            </template>                           
                        </el-table-column>
                        <el-table-column label="平均分" prop="ysfAvg" align="right" width="80" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                        <el-table-column label="与年级均分差值" prop="ysfDiff" align="right" width="80" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column">
                            <template #default="scope">
                                <span :class="{'minus-number':scope.row.ysfDiff<0, 'positive-number': scope.row.ysfDiff>0}">{{scope.row.ysfDiff}}</span>
                            </template>
                        </el-table-column>
                        <el-table-column label="平均分城区位次" prop="ysfSeat" align="right" width="80" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                        <el-table-column label="平均分城区百分比" prop="ysfPercent" align="right" width="80" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                        <el-table-column v-if="searchForm.subjectId != 100" label="精华-加权弱科分差" width="100" prop="ysfJqrk2" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                        <el-table-column v-if="searchForm.subjectId != 100" label="城区-加权弱科分差" width="100" prop="ysfJqrk" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                        <el-table-column v-if="searchForm.subjectId != 100" label="精华-弱科分差位次" width="100" prop="ysfRkfcwc2" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                        <el-table-column v-if="searchForm.subjectId != 100" label="城区-弱科分差位次" width="100" prop="ysfRkfcwc" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                        <el-table-column v-if="searchForm.subjectId != 100" label="成绩预测" width="120" prop="ysfCjyc" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                    </el-table-column>
                    <el-table-column label="等级分" prop="" align="center" header-align="center" :key="6">
                        <el-table-column label="上台阶率" prop="djfRate" width="100" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                        <el-table-column label="平均分年级排名" prop="djfRank" width="80" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                        <el-table-column label="平均分" prop="djfAvg" align="right" width="80" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                        <el-table-column label="与年级均分差值" prop="djfDiff" width="80" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column">
                            <template #default="scope">
                                <span :class="{'minus-number':scope.row.djfDiff<0, 'positive-number': scope.row.djfDiff>0}">{{scope.row.djfDiff}}</span>
                            </template>
                        </el-table-column>
                        <el-table-column label="平均分城区位次" v-if="xkSubjectShow()" prop="djfSeat" width="80" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                        <el-table-column label="平均分城区百分比" v-if="xkSubjectShow()" prop="djfPercent" width="80" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                    </el-table-column>
                </template>
                <template v-else>
                    <el-table-column label="原始分" prop="" align="center" header-align="center" :key="17">
                        <el-table-column label="平均分年级排名" prop="ysfRank" width="80" align="right" header-align="center" :key="7">
                            <template #header="scope">                                                            
                                <div @click="defaultSort = (defaultSort=='null' ? true : !defaultSort)" class="pointer-btn">
                                    <!-- <prompt-message tipType="middle" :scope="scope" :dataList="dataList" :middle="c.abProp+'Middle'" :many="c.abProp+'Many'"> -->
                                        <!-- <span slot="columnName"> -->
                                            <span>{{scope.column.label}}</span>
                                            <span class="caret-wrapper">
                                                <!-- 升序 -->
                                                <i class="sort-caret ascending" :class="{'default-sort': (defaultSort && defaultSort !='null')}"></i>
                                                <!-- 降序 -->
                                                <i class="sort-caret descending" :class="{'default-sort': !defaultSort && defaultSort != 'null'}"></i>
                                            </span>
                                        <!-- </span>  -->
                                    <!-- </prompt-message> -->
                                </div>                               
                            </template> 
                        </el-table-column>
                        <el-table-column label="平均分" prop="ysfAvg" width="80" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column" :key="8"></el-table-column>
                        <el-table-column label="与年级均分差值" prop="ysfDiff" width="80" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column" :key="9">
                            <template #default="scope">
                                <span :class="{'minus-number':scope.row.ysfDiff<0, 'positive-number': scope.row.ysfDiff>0}">{{scope.row.ysfDiff}}</span>
                            </template>
                        </el-table-column>
                        <el-table-column label="平均分城区位次" width="80" prop="ysfSeat" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column" :key="10"></el-table-column>
                        <el-table-column label="平均分城区百分比" prop="ysfPercent" align="right" width="80" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column" :key="11"></el-table-column>
                        <el-table-column v-if="searchForm.grades=='a11'" label="贡献值" prop="gxz" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column" :key="12" width="80"></el-table-column>
                        <el-table-column v-if="searchForm.grades=='a11'" label="人均贡献值" prop="rjgxz" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column" :key="13" width="80"></el-table-column>
                        <el-table-column v-if="searchForm.subjectId != 100" label="加权弱科分差" prop="ysfJqrk" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column" :key="14" width="120"></el-table-column>
                        <el-table-column v-if="searchForm.subjectId != 100" label="弱科分差位次" prop="ysfRkfcwc" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column" :key="15" width="120"></el-table-column>
                        <el-table-column v-if="searchForm.subjectId != 100 && searchForm.grades!='a11'" label="成绩预测" prop="ysfCjyc" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column" :key="16" width="90"></el-table-column>
                    </el-table-column>
                    <el-table-column label="等级分" prop="" align="center" header-align="center" :key="18">
                        <el-table-column label="平均分年级排名" prop="djfRank" width="80" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                        <el-table-column label="平均分" prop="djfAvg" align="right" width="80" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column"></el-table-column>
                        <el-table-column label="与年级均分差值" prop="djfDiff" width="80" align="right" header-align="center" :sort-orders="['ascending', 'descending']" sortable="column">
                            <template #default="scope">
                                <span :class="{'minus-number':scope.row.djfDiff<0, 'positive-number': scope.row.djfDiff>0}">{{scope.row.djfDiff}}</span>
                            </template>
                        </el-table-column>
                    </el-table-column>
                </template>
            </el-table>
            <h4>班级平均分与年级对比（原始分）</h4>
            <div id="classAvg" style="height: 500px;"></div>
            <h4>班级成绩分布箱形图（原始分）</h4>
            <div id="classGrade1" style="height: 450px;"></div>
            <div style="margin: 20px 0 0 0;">
                <span class="htitle-color e_phic" style="margin-left: 30px;">【图解】：本图在体现班级成绩整体水平的同时也体现了成绩的集中程度。中游学生分数分布区间（中间的箱子）长度越长，则代表学生成绩越分散；中游学生分数分布区间的位置越高，则代表学生整体水平越高。</span>
            </div>
            <h4>班级成绩分布表（原始分）</h4>
            <el-table
                :data="props.dataList['disTableList'] && props.dataList['disTableList']['list']" border highlight-current-row
                class="table tabs" ref="multipleTable2Ref" 
                :header-cell-style="{background: '#f1f1f1', color: '#333',borderColor: 'rgb(193 193 193)'}">
                <el-table-column label="10分一段" fixed prop="name" align="center" min-width="90" header-align="center"></el-table-column>
                <el-table-column :label="item" :prop="`score${index+1}`" align="right" header-align="center" min-width="90"
                    v-for="(item,index) in (props.dataList['disTableList'] && props.dataList['disTableList']['className'])" :key="index"></el-table-column>
                <el-table-column label="年级本段" prop="njbd" align="center" header-align="center" min-width="90"></el-table-column>
                <el-table-column label="年级本段(百分比)" prop="njbdBfb" align="center" header-align="center" min-width="110"></el-table-column>
                <el-table-column label="年级累计" prop="njlj" align="right" header-align="center" min-width="90"></el-table-column>
                <el-table-column label="年级累计(百分比)" prop="njljBfb" align="right" header-align="center" min-width="110"></el-table-column>
            </el-table>
        </div>
        
    </div>
</template>
<script setup name="classSum1">//查询维度——班级汇总
import wrongTr from '@/mixin/wrongTr';
import {sort} from '@/utils/helper';
import { boxPlot } from "@/components/echarts/boxPlot"; //盒须图
import { barLine } from "@/components/echarts/barLine"; //带有平均值辅助线的柱状图
import { nextTick, onMounted, reactive, ref, watch } from 'vue';
let props = defineProps({
    dataList: Object,
    searchForm: Object,
    searchForms1: Object,
})
// sort: sort,
let searchForms=reactive({
    data: {}
});
let isDel=ref(false);
let defaultSort=ref(true);//默认表格排序
const multipleTable2Ref = ref(null);
const multipleTableRef = ref(null);
let echartsOption = reactive({});
const emit = defineEmits(['classTo1'])//获取父组件的方法emit
onMounted(()=> {
    searchForms.data = props.searchForm;
    console.log(searchForms.data,'searchForms===')
    initPage();
});
let initPage=()=>{
    defaultSort.value = true;
    clearClassName();
    handlerDefaultSort(); //默认排序A-B
    xkSubjectShow();
    setTimeout(()=>{
        nextTick(() => {//解决固定列错位问题
            testEcharts(props.dataList);  
    //         multipleTable2Ref.value.doLayout();
        });
    }, 500)
};
    /**
 * 清除类
 */
let clearClassName=()=>{
    var selfClassName = document.getElementsByClassName("is-sortable");
    var hasDescendingClassNameStt = false;
    var hasAscendingClassNameStt = false;
    for(var a =0;a<selfClassName.length;a++){
        // 清除倒序className
        hasDescendingClassNameStt = selfClassName[a].classList.contains('descending');
        if(hasDescendingClassNameStt){
            selfClassName[a].classList.remove('descending')
        }
        // 清除正序className
        hasAscendingClassNameStt = selfClassName[a].classList.contains('ascending');
        if(hasAscendingClassNameStt){
            selfClassName[a].classList.remove('ascending')
        }
    }
};
//查询 班级汇总、与上次对比时，并查询“选考科目”时
let xkSubjectShow=()=>{
    return !((props.searchForms1.queryType==1 || props.searchForms1.queryType == 4) && props.searchForms1.subjectId > 103)
};
//还原默认排序
let restoreDefaultSort=()=>{
    defaultSort.value = true;
    clearClassName();
};
    /**
 * 页面渲染默认排序
 */
let handlerDefaultSort=()=>{
    if(multipleTableRef.value){
        clearClassName();
        multipleTableRef.value.clearSort();
    }        
    let order = '';
    if(defaultSort.value){//为true则为升序
        order='ascending';
    }else{
        order ='descending';
    }
    if(props.dataList && props.dataList.classNumList && props.dataList.classNumList['classList'].length){
        if(props.dataList.classNumList['classList'][0].hasOwnProperty('ysfRank')){//总分排名 排序
            sort(props.dataList.classNumList['classList'], 'ysfRank', order=='ascending');
        }
        // this.pagenation.pageIndex = 1;
    }
    
};  
/**
 * 表头排序
 */
let sortChange=(val, dataList)=>{ 
    if(val.prop != 'ysfRank'){
        defaultSort.value = 'null';
    }else{
        clearClassName();
    } 
    sort(dataList, val.prop, val.order=='ascending');
};
//求和
let getSummaries=(param)=>{
    // nextTick(() => {//第一次加载合计行不显示问题，重新渲染一次
    //     multipleTable.value.doLayout();
    // });
    const { columns, data } = param;
    const sums = [];
    let gradeList = props.dataList['classNumList'] && props.dataList['classNumList']['gradeList']&&props.dataList['classNumList']['gradeList'][0];
    if(!gradeList){ return false; }
    columns.forEach((column, index) => {
        sums.push(gradeList[column['property']]);         
    });               
    return sums;
};
let testEcharts=async (datas)=>{
    await getClassAvg(datas.avgMap);//柱状图
    await getClassGrade(datas.xxtMap, datas.xxtMap && datas.xxtMap.scoreList);//箱型图
};
//每页显示10条，其他
let computedPosition=(length, xArraylength)=> {
    // if(xArraylength>=20){
    //     return length <= 20 ?  38 : (100 -   Math.floor(38 / length * 100));
    //     return (20/xArraylength) * 100;
    // }else{
    //     return 100;//小于十条数据显示全部
    // }
    if(xArraylength > 20){
        return (20 / (xArraylength+1)) * 100;
    }else{
        return 100;
    }
};
/**
 * 班级成绩分布 盒须图
 */
let getClassGrade=(datas, ssw, sssw)=> {
    if(!datas) {return false;}
    // if(JSON.stringify(datas) == '{}'){ return false; }
    let data = ssw || [];
    let options = {
        id: "classGrade1",
        dataZoom: [{
            type: 'slider',
            show: true,
            xAxisIndex: [0],
            // left: '9%',
            bottom: -5,
            start: 0,
            end: computedPosition(20, datas.scoreList.length) //初始化滚动条
        }],
        legend: datas.className,
        yAxisName: "成绩",
    };
    console.log(data)
    boxPlot(data, options);
};
/**
 * 班级平均分与年级对比（原始分） 柱状图
 */
let getClassAvg=(datas)=> {
    if(!datas) {return false;}
    let class1 = datas.className;
    let options = {
        id: "classAvg",
        title: {
            text: "",
            x: "center",
            y: "top",
            textAlign: "left",
        },
        color1: "#F705EE",
        color2: "#95F204",
        legend: ["班级平均", "年级平均分"],
        dataZoom: [{
            type: 'slider',
            show: true,
            xAxisIndex: [0],
            // left: '9%',
            bottom: -5,
            start: 0,
            end: computedPosition(20, datas.scoreList.length) //初始化滚动条
        }],
        markLine: {
            /*以下设置一行后，平均线就没有开始和结束标记了（即看不见箭头了）*/
            symbol: "none",
            label: { 
                show: true, 
                position: 'insideEndTop' ,
            }, 
            itemStyle: {
                lineStyle: { type: 'solid', color: '#000' }, 
            },
            data: [
                {
                    name: '',
                    // 支持 'average', 'min', 'max'
                    type: 'line',
                    yAxisIndex: 1,
                    yAxis: datas.njavg || 0,                            
                    // 单独配置每条线的样式
                    lineStyle: {
                        color: '#F705EE',
                        width:3
                    },
                    label:{
                        position: "insideEndTop",
                    },
                }
            ]
        },
        yAxis: [
            {
                type: "value",
                max: datas.maxScore,
            },
        ],
        itemStyle: {
            label: {
                show: true, //开启显示
                // position: "center", //在上方显示
                textStyle: {
                    //数值样式
                    color: "rgb(240, 237, 237)",
                    fontSize: 12,
                },
            },
        },
        
        xAxis: {
            name: "",
            type: "category",
            data: class1,
            nameLocation: "center",
            nameTextStyle: {
                align: "center",
                // width: '100%',
                padding: [0, 0, 20, 0],
            },
        },
    };
    let data = {
        data0: datas.scoreList,
        // data1: njavg,
        // data2: tlxavg,
    };
    barLine(data, options);
};
//班级看板（行政班）
let toClassKanban=(row)=>{
    let params = {
        className:row.className,
        classId:row.classId,//班级ID
        isScoreType: props.dataList['grade'] == 17, //分数类型 0原始分 1等级分   高三才有等级分，其他默认原始分
        yearly: searchForm.yearly,
        testId: props.dataList['testIdA'],
        testIdA: props.dataList['testIdA'],//考试批次ID
        testIdB: props.dataList['testIdB'],
        subjectId: row.subjectId,
        subjectName: row.subjectName,
        grade: searchForm.grade,//年级
        classType: row.classType,//classType: 0行政班；1教学班；
    }
    emit('classTo1', params);
};
watch(()=>props.searchForms1, (val)=>{
    searchForms.data = val;
    initPage();        
},{deep: true});
watch(defaultSort, (newVal)=>{
    if(newVal == 'null'){//排序不是默认的，要把默认排序清空
        return false;
    }
    handlerDefaultSort();
},{deep: true});
// export default {
//     name: 'classSum1',//查询维度——班级汇总
//     mixins: [wrongTr],
//     props: {
//         dataList: Object,
//         searchForm: Object,
//         searchForms1: Object,
//     },
//     data() {
//         return {
//             sort: sort,
//             searchForms: {},
//             isDel: false,
//             defaultSort: true,//默认表格排序
//         }
//     },
//     mounted(){
//         this.searchForms = this.searchForm;
//         this.initPage();
//     },
//     computed: {
        
//     },
//   /*   beforeRouteLeave (to, from, next) {   
//         if (to.name == 'classBoard') {
//             debugger
//             // 根据是否删除操作，进行判断是否需要使用缓存数据
//             to.meta.isUseCache = this.isDel; 
//             this.isDel=false;
//         } else {
//             to.meta.isUseCache = false;
//         }       
//         next();     
//     }, */
//     watch: {
//         'searchForms1':{
//             handler: function(val){
//                 this.initPage();
//             },
//             deep: true
//         },
//         'defaultSort': function(newVal, oldVal){
//             if(newVal == 'null'){//排序不是默认的，要把默认排序清空
//                 return false;
//             }
//             this.handlerDefaultSort();
//         },
//         // 'searchForms.queryTypes': {
//         //     handler: function(newVal, oldVal){
//         //         if(newVal=='a1'){
//         //             this.initPage();
//         //         }
//         //     },
//         //     deep: true
//         // },
//         // 'searchForms.subjectId': {
//         //     handler: function(newVal, oldVal){
//         //         if(newVal!=oldVal){
//         //             this.initPage();
//         //         }
//         //     },
//         //     deep: true
//         // },
//         // 'searchForms.grades':{
//         //     handler: function(val){
//         //         this.initPage();             
//         //     },
//         //     deep: true
//         // },
//         // 'dataList':{
//         //     handler: function(val){
//         //         this.initPage();
//         //     },
//         //     deep: true
//         // }
//     },
//     methods: {
//         initPage(){
//             let _this = this;
//             _this.defaultSort = true;
//             _this.clearClassName();
//             _this.handlerDefaultSort(); //默认排序A-B
//             _this.xkSubjectShow();
//             setTimeout(()=>{
//                 this.$nextTick(() => {//解决固定列错位问题
//                     _this.testEcharts(_this.dataList);  
//                     _this.$refs.multipleTable2.doLayout();
//                 });
//             }, 500)
           
//         },
//          /**
//          * 清除类
//          */
//         clearClassName(){
//             var selfClassName = document.getElementsByClassName("is-sortable");
//             var hasDescendingClassNameStt = false;
//             var hasAscendingClassNameStt = false;
//             for(var a =0;a<selfClassName.length;a++){
//                 // 清除倒序className
//                 hasDescendingClassNameStt = selfClassName[a].classList.contains('descending');
//                 if(hasDescendingClassNameStt){
//                     selfClassName[a].classList.remove('descending')
//                 }
//                 // 清除正序className
//                 hasAscendingClassNameStt = selfClassName[a].classList.contains('ascending');
//                 if(hasAscendingClassNameStt){
//                     selfClassName[a].classList.remove('ascending')
//                 }
//             }
//         },
//         //查询 班级汇总、与上次对比时，并查询“选考科目”时
//         xkSubjectShow(){
//             return !((this.searchForms1.queryType==1 || this.searchForms1.queryType == 4) && this.searchForms1.subjectId > 103)
//         },
//         //还原默认排序
//         restoreDefaultSort(){
//             this.defaultSort = true;
//             this.clearClassName();
//         },
//          /**
//          * 页面渲染默认排序
//          */
//         handlerDefaultSort(){
//             if(this.$refs.multipleTable){
//                 this.clearClassName();
//                 this.$refs.multipleTable.clearSort();
//             }        
//             let order = '';
//             if(this.defaultSort){//为true则为升序
//                 order='ascending';
//             }else{
//                 order ='descending';
//             }
//             if(this.dataList && this.dataList.classNumList && this.dataList.classNumList['classList'].length){
//                 if(this.dataList.classNumList['classList'][0].hasOwnProperty('ysfRank')){//总分排名 排序
//                     this.sort(this.dataList.classNumList['classList'], 'ysfRank', order=='ascending');
//                 }
//                 // this.pagenation.pageIndex = 1;
//             }
            
//         },  
//         /**
//          * 表头排序
//          */
//         sortChange(val, dataList){ 
//             if(val.prop != 'ysfRank'){
//                 this.defaultSort = 'null';
//             }else{
//                 this.clearClassName();
//             } 
//             this.sort(dataList, val.prop, val.order=='ascending');
//         },
//         //求和
//         getSummaries(param){
//             let _this =this;            
//             this.$nextTick(() => {//第一次加载合计行不显示问题，重新渲染一次
//                 _this.$refs.multipleTable.doLayout();
//             });
//             const { columns, data } = param;
//             const sums = [];
//             let gradeList = this.dataList['classNumList'] && this.dataList['classNumList']['gradeList']&&this.dataList['classNumList']['gradeList'][0];
//             if(!gradeList){ return false; }
//             columns.forEach((column, index) => {
//                 sums.push(gradeList[column['property']]);         
//             });               
//             return sums;
//         },
//         async testEcharts(datas){
//             await this.getClassAvg(datas.avgMap);//柱状图
//             await this.getClassGrade(datas.xxtMap, datas.xxtMap && datas.xxtMap.scoreList);//箱型图
//         },
//         //每页显示10条，其他
//         computedPosition(length, xArraylength) {
//             // if(xArraylength>=20){
//             //     return length <= 20 ?  38 : (100 -   Math.floor(38 / length * 100));
//             //     return (20/xArraylength) * 100;
//             // }else{
//             //     return 100;//小于十条数据显示全部
//             // }
//             if(xArraylength > 20){
//                 return (20 / (xArraylength+1)) * 100;
//             }else{
//                 return 100;
//             }
//         },
//         /**
//          * 班级成绩分布 盒须图
//          */
//         getClassGrade(datas, ssw, sssw) {
//             if(!datas) {return false;}
//             // if(JSON.stringify(datas) == '{}'){ return false; }
//             let data = ssw || [];
//             let options = {
//                 id: "classGrade1",
//                 dataZoom: [{
//                     type: 'slider',
//                     show: true,
//                     xAxisIndex: [0],
//                     // left: '9%',
//                     bottom: -5,
//                     start: 0,
//                     end: this.computedPosition(20, datas.scoreList.length) //初始化滚动条
//                 }],
//                 legend: datas.className,
//                 yAxisName: "成绩",
//             };
//             // console.log(data)
//             boxPlot(data, options);
//         },
//          /**
//          * 班级平均分与年级对比（原始分） 柱状图
//          */
//         getClassAvg(datas) {
//             if(!datas) {return false;}
//             let class1 = datas.className;
//             // let tlxavg = [];
//             // let njavg = [];
//             // for (let index = 0; index < class1.length; index++) {
//             //     tlxavg.push(datas.tlxavg); //同类校平均分
//             //     njavg.push(datas.njavg); //年级平均分
//             // }
//             let options = {
//                 id: "classAvg",
//                 title: {
//                     text: "",
//                     x: "center",
//                     y: "top",
//                     textAlign: "left",
//                 },
//                 color1: "#F705EE",
//                 color2: "#95F204",
//                 legend: ["班级平均", "年级平均分"],
//                 dataZoom: [{
//                     type: 'slider',
//                     show: true,
//                     xAxisIndex: [0],
//                     // left: '9%',
//                     bottom: -5,
//                     start: 0,
//                     end: this.computedPosition(20, datas.scoreList.length) //初始化滚动条
//                 }],
//                 markLine: {
//                     /*以下设置一行后，平均线就没有开始和结束标记了（即看不见箭头了）*/
//                     symbol: "none",
//                     itemStyle: {
//                         normal: { 
//                             lineStyle: { type: 'solid', color: '#000' }, 
//                             label: { 
//                                 show: true, 
//                                 position: 'insideEndTop' ,
//                             } 
//                         },
//                     },
//                     data: [
//                         {
//                             name: '',
//                             // 支持 'average', 'min', 'max'
//                             type: 'line',
//                             yAxisIndex: 1,
//                             yAxis: datas.njavg || 0,                            
//                             // 单独配置每条线的样式
//                             lineStyle: {
//                                 color: '#F705EE',
//                                 width:3
//                             },
//                             label:{
//                                 position: "insideEndTop",
//                             },
//                         }
//                     ]
//                 },
//                 yAxis: [
//                     {
//                         type: "value",
//                         max: datas.maxScore,
//                     },
//                 ],
//                 itemStyle: {
//                     normal: {
//                         label: {
//                         show: true, //开启显示
//                         // position: "center", //在上方显示
//                         textStyle: {
//                                 //数值样式
//                                 color: "rgb(240, 237, 237)",
//                                 fontSize: 12,
//                             },
//                         },
//                     },
//                 },
//                 xAxis: {
//                     name: "",
//                     type: "category",
//                     data: class1,
//                     nameLocation: "center",
//                     nameTextStyle: {
//                         align: "center",
//                         // width: '100%',
//                         padding: [0, 0, 20, 0],
//                     },
//                 },
//             };
//             let data = {
//                 data0: datas.scoreList,
//                 // data1: njavg,
//                 // data2: tlxavg,
//             };
//             barLine(data, options);
//         },
//         //班级看板（行政班）
//         toClassKanban(row){
//             let params = {
//                 className:row.className,
//                 classId:row.classId,//班级ID
//                 isScoreType: this.dataList['grade'] == 17, //分数类型 0原始分 1等级分   高三才有等级分，其他默认原始分
//                 yearly: this.searchForm.yearly,
//                 testId: this.dataList['testIdA'],
//                 testIdA: this.dataList['testIdA'],//考试批次ID
//                 testIdB: this.dataList['testIdB'],
//                 subjectId: row.subjectId,
//                 subjectName: row.subjectName,
//                 grade: this.searchForm.grade,//年级
//                 classType: row.classType,//classType: 0行政班；1教学班；
//             }
//             this.$emit('classTo1', params);
//         }
//     }
// }
</script>
<style lang="scss" scoped>
.conta_main{
    h4{
        margin-top: 20px;
    }
    /* 负数 */
    .minus-number{
        color: red;
    }
    .positive-number{
        color: #70B603;
    }
}
</style>